package com.xiaow.controller;

import com.xiaow.mapper.UserMapper;
import com.xiaow.utils.MD5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName LoginController
 * @Author 蚂蚁课堂余胜军 QQ644064779 www.mayikt.com
 * @Version V1.0
 **/
@Controller
public class LoginController {
    @Autowired
    UserMapper userMapper;
    @GetMapping("/login")
    public String login() {
        return "login";
    }


    @GetMapping("/logout")
    @ResponseBody
    public String logout(String username){
        String saltRandom = MD5Util.getSaltRandom();
        userMapper.update(username,saltRandom);
        return "sucess";
    }

}
